/* 
 * File:   IDirectory.h
 * Author: alexey
 *
 * Created on 30 Март 2011 г., 14:10
 */

#ifndef IDIRECTORY_H
#define	IDIRECTORY_H
#include <sys/types.h>
#include "IServiceLocator.h"
#include "IFile.h"
#include <vector>
namespace storagemon
{
    class IDirectory : public IService
    {
    public:
        virtual ~IDirectory() {};
        virtual bool operator==(const IDirectory &other) const
        {
            bool res = true;
            if (other.id() != this->id())
                res = false;
            if (other.parent_id() != this->parent_id())
                res = false;
            if (strcmp(other.name(), this->name()) != 0)
                res = false;
            if (strcmp(other.path(), this->path()) != 0)
                res = false;
            return res;
        }
    public:
        virtual u_long id() const = 0;
        virtual u_long parent_id() const = 0;
        virtual const char* name() const = 0;
        virtual const char* path() const = 0;
        virtual bool add_file(IFile* file) = 0;
        virtual bool remove_file(u_long id) = 0;
        virtual u_long size() const = 0;
        virtual std::vector<IFile*>::iterator get_file(u_long id) = 0;
    };

    const char DIRECTORYOBJECT[] = "directoryobject";
}

#endif	/* IDIRECTORY_H */

